"""数据库迁移脚本执行器

这个脚本用于执行数据库迁移，添加新的字段或修改数据库结构
"""
import importlib
import sys
import os

sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')))

from app.db.session import engine
from app.db.migrations import add_mcp_config

def run_migrations():
    """运行所有迁移脚本"""
    migrations = [
        add_mcp_config
    ]
    
    with engine.connect() as connection:
        for migration in migrations:
            print(f"运行迁移: {migration.__name__}")
            migration.upgrade(connection)
    
    print("所有迁移已完成")

if __name__ == "__main__":
    run_migrations() 